<div class="layui-inline">
    <input type="number" name="member_id" id="addverifyer" value="" lay-verify="required" autocomplete="on" placeholder="请输入用户ID" class="layui-input">
</div>
<div class="layui-inline">
    <button type="button" class="layui-btn" id="addverifyerbtn">添加核销员</button>
    <a href="javascript:;" data-qrcodeurl="" target="_blank" class="layui-btn layui-btn-normal" id="addverifyerqrcode">扫码绑定核销员(抖音扫码)</a>
</div>
<table id="LAY-verifyer-manage" lay-filter="LAY-verifyer-manage"></table>
<script type="text/html" id="verifyerMemberTpl">
<img style="display:inline-block;width:30px;height:30px" src= {{ d.avatar }} >
{{ d.nickname }}
</script>
<script type="text/html" id="ctimeTpl"> 
{{# var date = new Date(d.createtime * 1000);
    var dt = date.getFullYear() + '-';
    dt += (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    dt += (Array(2).join(0) + date.getDate()).slice(-2) + ' ';
    dt += (Array(2).join(0) + date.getHours()).slice(-2) + ':';
    dt += (Array(2).join(0) + date.getMinutes()).slice(-2) + ':';
    dt += (Array(2).join(0) + date.getSeconds()).slice(-2); }}
{{ dt }}
</script>
<script type="text/html" id="table-verifyer-oper">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
<script>
layui.use('verifyer', layui.factory('verifyer')).use(['admin', 'verifyer', 'table', 'upload'], function(){
var $ = layui.$
,admin = layui.admin
,view = layui.view
,table = layui.table
,form = layui.form
,upload = layui.upload;

    $('#addverifyerbtn').on('click', function(){
        if($('#addverifyer').val() == ''){
            layer.msg('请填写用户ID');
            return false;
        }
        $.post(layui.setter.baseUrl+'sale/addverifyer',{
            id: layui.sale_id,
            member_id: $('#addverifyer').val()
        },function(res){
            layer.msg(res.msg);
            if(res.code == 0){
            layui.table.reload('LAY-verifyer-manage');
            }
        });
    });
    $('#addverifyerqrcode').on('click', function(){
        layui.params.qrcodeurl = $(this).data('qrcodeurl');
        admin.popup({
            title: "扫码绑定核销员(抖音扫码)，两分钟有效，过期重新获取二维码！",
            area: ['400px', '400px'],
            id: "LAY-popup-sale-verifyer-qrcode",
            success: function(layero, index) {
                view(this.id).render("sale/verifyerqr");
            }
        });
        return false;
    });
});
</script>